import {defineStore} from 'pinia';

export const useCollapsedStore = defineStore('collapsed', {
    state: () => ({
        isCollapsed: localStorage.getItem('isCollapsed') ? JSON.parse(localStorage.getItem('isCollapsed')) : false,
    }),

    actions: {
        // 切换折叠状态
        toggleCollapsed() {
            this.setCollapsed(!this.isCollapsed)
        },

        // 设置主题
        setCollapsed(status) {
            this.isCollapsed = status;
            localStorage.setItem('isCollapsed', this.isCollapsed);
        },
    },

})